package com.bw.fxzk.fg

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.bw.base.net.mvvm.BaseViewFragment
import com.bw.fxzk.R
import com.bw.fxzk.ScoreAdapter
import com.bw.fxzk.databinding.FragmentAllBinding
import com.bw.fxzk.room.AppDBUtlis


class AllFragment : BaseViewFragment<FragmentAllBinding>() {
    lateinit var scoreAdapter: ScoreAdapter
    override fun initView() {
        scoreAdapter=ScoreAdapter()
        binding.rv.adapter=scoreAdapter
        binding.rv.layoutManager=LinearLayoutManager(context)
        queryAll()
    }

    fun queryAll() {
        val queryAll = AppDBUtlis.getDB().getScoreDao().queryAll()
        scoreAdapter.data.clear()
        scoreAdapter.data.addAll(queryAll)
        scoreAdapter.notifyDataSetChanged()
    }

    override fun initData() {

    }

    override fun getLayoutId(): Int = R.layout.fragment_all
    override fun onResume() {
        super.onResume()
        queryAll()
    }
}